package roma.lab1;

import java.util.HashMap;
import java.util.Map;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

import android.content.Context;
import android.content.SharedPreferences;

public class RomaHandler extends DefaultHandler {

	private Map<String, Float> map = new HashMap<String, Float>();
	private String datum;
	
	@Override
	public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
		if(localName.equals("Cube")){
			if(attributes.getValue("time") != null){
				datum = attributes.getValue("time");
				
			}else if(attributes.getValue("rate") != null){
				map.put(attributes.getValue("currency"), Float.parseFloat(attributes.getValue("rate")));
			}
		}
	}
	
	public Map<String, Float> getHashMap(){
		return map;
	}
	
	public String getDate(){
		return datum;
	}

}
